home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / prog / gnu-c / src / gcc-2.7.0-amiga / gcc.info-6 (.txt) < prev    next >
GNU Info File  |  1995-06-16  |  23KB  |  386 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  5. Boston, MA 02111-1307 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software
  7. Foundation, Inc.
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided also
  13. that the sections entitled "GNU General Public License," "Funding for
  14. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  15. included exactly as in the original, and provided that the entire
  16. resulting derived work is distributed under the terms of a permission
  17. notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the sections entitled "GNU General Public
  21. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  22. `Look And Feel'", and this permission notice, may be included in
  23. translations approved by the Free Software Foundation instead of in the
  24. original English.
  25. File: gcc.info,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  26. Installing GNU CC
  27. *****************
  28. * Menu:
  29. * Configurations::    Configurations Supported by GNU CC.
  30. * Other Dir::     Compiling in a separate directory (not where the source is).
  31. * Cross-Compiler::   Building and installing a cross-compiler.
  32. * Sun Install::   See below for installation on the Sun.
  33. * VMS Install::   See below for installation on VMS.
  34. * Collect2::      How `collect2' works; how it finds `ld'.
  35. * Header Dirs::   Understanding the standard header file directories.
  36.    Here is the procedure for installing GNU CC on a Unix system.  See
  37. *Note VMS Install::, for VMS systems.  In this section we assume you
  38. compile in the same directory that contains the source files; see *Note
  39. Other Dir::, to find out how to compile in a separate directory on Unix
  40. systems.
  41.    You cannot install GNU C by itself on MSDOS; it will not compile
  42. under any MSDOS compiler except itself.  You need to get the complete
  43. compilation package DJGPP, which includes binaries as well as sources,
  44. and includes all the necessary compilation tools and libraries.
  45.   1. If you have built GNU CC previously in the same directory for a
  46.      different target machine, do `make distclean' to delete all files
  47.      that might be invalid.  One of the files this deletes is
  48.      `Makefile'; if `make distclean' complains that `Makefile' does not
  49.      exist, it probably means that the directory is already suitably
  50.      clean.
  51.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  52.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  53.      libraries which have bugs.
  54.   3. Specify the host, build and target machine configurations.  You do
  55.      this by running the file `configure'.
  56.      The "build" machine is the system which you are using, the "host"
  57.      machine is the system where you want to run the resulting compiler
  58.      (normally the build machine), and the "target" machine is the
  59.      system for which you want the compiler to generate code.
  60.      If you are building a compiler to produce code for the machine it
  61.      runs on (a native compiler), you normally do not need to specify
  62.      any operands to `configure'; it will try to guess the type of
  63.      machine you are on and use that as the build, host and target
  64.      machines.  So you don't need to specify a configuration when
  65.      building a native compiler unless `configure' cannot figure out
  66.      what your configuration is or guesses wrong.
  67.      In those cases, specify the build machine's "configuration name"
  68.      with the `--build' option; the host and target will default to be
  69.      the same as the build machine.  (If you are building a
  70.      cross-compiler, see *Note Cross-Compiler::.)
  71.      Here is an example:
  72.      from an MSDOS console window or from the program manager dialog
  73.      box.  Configure.bat assumes that you have already installed and in
  74.      your path a Unix-like sed program which is used to modify
  75.      Makefile.in to create a working Makefile.
  76.           ./configure --build=sparc-sun-sunos4.1
  77.      A configuration name may be canonical or it may be more or less
  78.      abbreviated.
  79.      A canonical configuration name has three parts, separated by
  80.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  81.      parts may themselves contain dashes; `configure' can figure out
  82.      which dashes serve which purpose.)  For example,
  83.      `m68k-sun-sunos4.1' specifies a Sun 3.
  84.      You can also replace parts of the configuration by nicknames or
  85.      aliases.  For example, `sun3' stands for `m68k-sun', so
  86.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  87.      use simply `sun3-sunos', since the version of SunOS is assumed by
  88.      default to be version 4.  `sun3-bsd' also works, since `configure'
  89.      knows that the only BSD variant on a Sun 3 is SunOS.
  90.      You can specify a version number after any of the system types,
  91.      and some of the CPU types.  In most cases, the version is
  92.      irrelevant, and will be ignored.  So you might as well specify the
  93.      version if you know it.
  94.      See *Note Configurations::, for a list of supported configuration
  95.      names and notes on many of the configurations.  You should check
  96.      the notes in that section before proceeding any further with the
  97.      installation of GNU CC.
  98.      There are four additional options you can specify independently to
  99.      describe variant hardware and software configurations.  These are
  100.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  101.     `--with-gnu-as'
  102.           If you will use GNU CC with the GNU assembler (GAS), you
  103.           should declare this by using the `--with-gnu-as' option when
  104.           you run `configure'.
  105.           Using this option does not install GAS.  It only modifies the
  106.           output of GNU CC to work with GAS.  Building and installing
  107.           GAS is up to you.
  108.           Conversely, if you *do not* wish to use GAS and do not specify
  109.           `--with-gnu-as' when building GNU CC, it is up to you to make
  110.           sure that GAS is not installed.  GNU CC searches for a
  111.           program named `as' in various directories; if the program it
  112.           finds is GAS, then it runs GAS.  If you are not sure where
  113.           GNU CC finds the assembler it is using, try specifying `-v'
  114.           when you run it.
  115.           The systems where it makes a difference whether you use GAS
  116.           are
  117.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  118.           `i386-ANY-isc',
  119.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  120.           `m68k-sony-bsd',
  121.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv',
  122.           `ANY-lynx-lynxos', and `mips-ANY').  On any other system,
  123.           `--with-gnu-as' has no effect.
  124.           On the systems listed above (except for the HP-PA, for ISC on
  125.           the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
  126.           should also use the GNU linker (and specify `--with-gnu-ld').
  127.     `--with-gnu-ld'
  128.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  129.           linker with GNU CC.
  130.           This option does not cause the GNU linker to be installed; it
  131.           just modifies the behavior of GNU CC to work with the GNU
  132.           linker.  Specifically, it inhibits the installation of
  133.           `collect2', a program which otherwise serves as a front-end
  134.           for the system's linker on most configurations.
  135.     `--with-stabs'
  136.           On MIPS based systems and on Alphas, you must specify whether
  137.           you want GNU CC to create the normal ECOFF debugging format,
  138.           or to use BSD-style stabs passed through the ECOFF symbol
  139.           table.  The normal ECOFF debug format cannot fully handle
  140.           languages other than C.  BSD stabs format can handle other
  141.           languages, but it only works with the GNU debugger GDB.
  142.           Normally, GNU CC uses the ECOFF debugging format by default;
  143.           if you prefer BSD stabs, specify `--with-stabs' when you
  144.           configure GNU CC.
  145.           No matter which default you choose when you configure GNU CC,
  146.           the user can use the `-gcoff' and `-gstabs+' options to
  147.           specify explicitly the debug format for a particular
  148.           compilation.
  149.           `--with-stabs' is meaningful on the ISC system on the 386,
  150.           also, if `--with-gas' is used.  It selects use of stabs
  151.           debugging information embedded in COFF output.  This kind of
  152.           debugging information supports C++ well; ordinary COFF
  153.           debugging information does not.
  154.           `--with-stabs' is also meaningful on 386 systems running
  155.           SVR4.  It selects use of stabs debugging information embedded
  156.           in ELF output.  The C++ compiler currently (2.6.0) does not
  157.           support the DWARF debugging information normally used on 386
  158.           SVR4 platforms; stabs provide a workable alternative.  This
  159.           requires gas and gdb, as the normal SVR4 tools can not
  160.           generate or interpret stabs.
  161.     `--nfp'
  162.           On certain systems, you must specify whether the machine has
  163.           a floating point unit.  These systems include
  164.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  165.           `--nfp' currently has no effect, though perhaps there are
  166.           other systems where it could usefully make a difference.
  167.      The `configure' script searches subdirectories of the source
  168.      directory for other compilers that are to be integrated into GNU
  169.      CC.  The GNU compiler for C++, called G++ is in a subdirectory
  170.      named `cp'.  `configure' inserts rules into `Makefile' to build
  171.      all of those compilers.
  172.      Here we spell out what files will be set up by `configure'.
  173.      Normally you need not be concerned with these files.
  174.         * A symbolic link named `config.h' is made to the top-level
  175.           config file for the machine you will run the compiler on
  176.           (*note Config::.).  This file is responsible for defining
  177.           information about the host machine.  It includes `tm.h'.
  178.           The top-level config file is located in the subdirectory
  179.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  180.           `xm-MACHINE.h', but there are some exceptions.
  181.           If your system does not support symbolic links, you might
  182.           want to set up `config.h' to contain a `#include' command
  183.           which refers to the appropriate file.
  184.         * A symbolic link named `tconfig.h' is made to the top-level
  185.           config file for your target machine.  This is used for
  186.           compiling certain programs to run on that machine.
  187.         * A symbolic link named `tm.h' is made to the
  188.           machine-description macro file for your target machine.  It
  189.           should be in the subdirectory `config' and its name is often
  190.           `MACHINE.h'.
  191.         * A symbolic link named `md' will be made to the machine
  192.           description pattern file.  It should be in the `config'
  193.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  194.           is often not the same as the name used in the `tm.h' file
  195.           because the `md' files are more general.
  196.         * A symbolic link named `aux-output.c' will be made to the
  197.           output subroutine file for your machine.  It should be in the
  198.           `config' subdirectory and its name should be `MACHINE.c'.
  199.         * The command file `configure' also constructs the file
  200.           `Makefile' by adding some text to the template file
  201.           `Makefile.in'.  The additional text comes from files in the
  202.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  203.           files do not exist, it means nothing needs to be added for a
  204.           given target or host.
  205.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  206.      If you want to install its files somewhere else, specify
  207.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  208.      name to use instead of `/usr/local' for all purposes with one
  209.      exception: the directory `/usr/local/include' is searched for
  210.      header files no matter where you install the compiler.  To override
  211.      this name, use the `--local-prefix' option below.
  212.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  213.      directory `DIR/include' for locally installed header files
  214.      *instead* of `/usr/local/include'.
  215.      You should specify `--local-prefix' *only* if your site has a
  216.      different convention (not `/usr/local') for where to put
  217.      site-specific files.
  218.      *Do not* specify `/usr' as the `--local-prefix'!  The directory
  219.      you use for `--local-prefix' *must not* contain any of the
  220.      system's standard header files.  If it did contain them, certain
  221.      programs would be miscompiled (including GNU Emacs, on certain
  222.      targets), because this would override and nullify the header file
  223.      corrections made by the `fixincludes' script.
  224.   6. Make sure the Bison parser generator is installed.  (This is
  225.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  226.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  227.      change the `.y' files.)
  228.      Bison versions older than Sept 8, 1988 will produce incorrect
  229.      output for `c-parse.c'.
  230.   7. If you have chosen a configuration for GNU CC which requires other
  231.      GNU tools (such as GAS or the GNU linker) instead of the standard
  232.      system tools, install the required tools in the build directory
  233.      under the names `as', `ld' or whatever is appropriate.  This will
  234.      enable the compiler to find the proper tools for compilation of
  235.      the program `enquire'.
  236.      Alternatively, you can do subsequent compilation using a value of
  237.      the `PATH' environment variable such that the necessary GNU tools
  238.      come before the standard system tools.
  239.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  240.      directory.
  241.      `LANGUAGES=c' specifies that only the C compiler should be
  242.      compiled.  The makefile normally builds compilers for all the
  243.      supported languages; currently, C, C++ and Objective C.  However,
  244.      C is the only language that is sure to work when you build with
  245.      other non-GNU C compilers.  In addition, building anything but C
  246.      at this stage is a waste of time.
  247.      In general, you can specify the languages to build by typing the
  248.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  249.      the list `c', `c++', and `objective-c'.  If you have any
  250.      additional GNU compilers as subdirectories of the GNU CC source
  251.      directory, you may also specify their names in this list.
  252.      Ignore any warnings you may see about "statement not reached" in
  253.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  254.      escape sequence" are normal in `genopinit.c' and perhaps some
  255.      other files.  Likewise, you should ignore warnings about "constant
  256.      is so large that it is unsigned" in `insn-emit.c' and
  257.      `insn-recog.c'.  Any other compilation errors may represent bugs in
  258.      the port to your machine or operating system, and should be
  259.      investigated and reported (*note Bugs::.).
  260.      Some commercial compilers fail to compile GNU CC because they have
  261.      bugs or limitations.  For example, the Microsoft compiler is said
  262.      to run out of macro space.  Some Ultrix compilers run out of
  263.      expression space; then you need to break up the statement where
  264.      the problem happens.
  265.   9. If you are building a cross-compiler, stop here.  *Note
  266.      Cross-Compiler::.
  267.  10. Move the first-stage object files and executables into a
  268.      subdirectory with this command:
  269.           make stage1
  270.      The files are moved into a subdirectory named `stage1'.  Once
  271.      installation is complete, you may wish to delete these files with
  272.      `rm -r stage1'.
  273.  11. If you have chosen a configuration for GNU CC which requires other
  274.      GNU tools (such as GAS or the GNU linker) instead of the standard
  275.      system tools, install the required tools in the `stage1'
  276.      subdirectory under the names `as', `ld' or whatever is
  277.      appropriate.  This will enable the stage 1 compiler to find the
  278.      proper tools in the following stage.
  279.      Alternatively, you can do subsequent compilation using a value of
  280.      the `PATH' environment variable such that the necessary GNU tools
  281.      come before the standard system tools.
  282.  12. Recompile the compiler with itself, with this command:
  283.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  284.      This is called making the stage 2 compiler.
  285.      The command shown above builds compilers for all the supported
  286.      languages.  If you don't want them all, you can specify the
  287.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  288.      should contain one or more words from the list `c', `c++',
  289.      `objective-c', and `proto'.  Separate the words with spaces.
  290.      `proto' stands for the programs `protoize' and `unprotoize'; they
  291.      are not a separate language, but you use `LANGUAGES' to enable or
  292.      disable their installation.
  293.      If you are going to build the stage 3 compiler, then you might
  294.      want to build only the C language in stage 2.
  295.      Once you have built the stage 2 compiler, if you are short of disk
  296.      space, you can delete the subdirectory `stage1'.
  297.      On a 68000 or 68020 system lacking floating point hardware, unless
  298.      you have selected a `tm.h' file that expects by default that there
  299.      is no such hardware, do this instead:
  300.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  301.  13. If you wish to test the compiler by compiling it with itself one
  302.      more time, install any other necessary GNU tools (such as GAS or
  303.      the GNU linker) in the `stage2' subdirectory as you did in the
  304.      `stage1' subdirectory, then do this:
  305.           make stage2
  306.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
  307.      This is called making the stage 3 compiler.  Aside from the `-B'
  308.      option, the compiler options should be the same as when you made
  309.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  310.      same.  The command shown above builds compilers for all the
  311.      supported languages; if you don't want them all, you can specify
  312.      the languages to build by typing the argument `LANGUAGES="LIST"',
  313.      as described above.
  314.      If you do not have to install any additional GNU tools, you may
  315.      use the command
  316.           make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
  317.      instead of making `stage1', `stage2', and performing the two
  318.      compiler builds.
  319.  14. Then compare the latest object files with the stage 2 object
  320.      files--they ought to be identical, aside from time stamps (if any).
  321.      On some systems, meaningful comparison of object files is
  322.      impossible; they always appear "different."  This is currently
  323.      true on Solaris and probably on all systems that use ELF object
  324.      file format.  On some versions of Irix on SGI machines and OSF/1
  325.      on Alpha systems, you will not be able to compare the files
  326.      without specifying `-save-temps'; see the description of
  327.      individual systems above to see if you get comparison failures.
  328.      You may have similar problems on other systems.
  329.      Use this command to compare the files:
  330.           make compare
  331.      This will mention any object files that differ between stage 2 and
  332.      stage 3.  Any difference, no matter how innocuous, indicates that
  333.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  334.      therefore a potentially serious bug which you should investigate
  335.      and report (*note Bugs::.).
  336.      If your system does not put time stamps in the object files, then
  337.      this is a faster way to compare them (using the Bourne shell):
  338.           for file in *.o; do
  339.           cmp $file stage2/$file
  340.           done
  341.      If you have built the compiler with the `-mno-mips-tfile' option on
  342.      MIPS machines, you will not be able to compare the files.
  343.  15. Build the Objective C library (if you have built the Objective C
  344.      compiler).  Here is the command to do this:
  345.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  346.  16. Install the compiler driver, the compiler's passes and run-time
  347.      support with `make install'.  Use the same value for `CC',
  348.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  349.      that are being installed.  One reason this is necessary is that
  350.      some versions of Make have bugs and recompile files gratuitously
  351.      when you do this step.  If you use the same variable values, those
  352.      files will be recompiled properly.
  353.      For example, if you have built the stage 2 compiler, you can use
  354.      the following command:
  355.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  356.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  357.      `cpp' and `libgcc.a' in the directory
  358.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  359.      compiler driver program looks for them.  Here TARGET is the target
  360.      machine type specified when you ran `configure', and VERSION is
  361.      the version number of GNU CC.  This naming scheme permits various
  362.      versions and/or cross-compilers to coexist.
  363.      This also copies the driver program `xgcc' into
  364.      `/usr/local/bin/gcc', so that it appears in typical execution
  365.      search paths.
  366.      On some systems, this command causes recompilation of some files.
  367.      This is usually due to bugs in `make'.  You should either ignore
  368.      this problem, or use GNU Make.
  369.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  370.      this bug, be sure to install the executables of GNU CC that were
  371.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  372.      not stage 1.)  They use `alloca' as a built-in function and never
  373.      the one in the library.*
  374.      (It is usually better to install GNU CC executables from stage 2
  375.      or 3, since they usually run faster than the ones compiled with
  376.      some other compiler.)
  377.  17. Install the Objective C library (if you are installing the
  378.      Objective C compiler).  Here is the command to do this:
  379.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  380.  18. If you're going to use C++, it's likely that you need to also
  381.      install the libg++ distribution.  It should be available from the
  382.      same place where you got the GNU C distribution.  Just as GNU C
  383.      does not distribute a C runtime library, it also does not include
  384.      a C++ run-time library.  All I/O functionality, special class
  385.      libraries, etc., are available in the libg++ distribution.
  386.